package com.cgx.config;

import com.cgx.webmagic.MyPageProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import us.codecraft.webmagic.Spider;

import javax.annotation.PostConstruct;

/**
 * @author chenguanxin
 * @date 2020-07-17 22:43
 */
@Component
public class WebMagicConfig {

    @Autowired
    MyPageProcessor myPageProcessor;

    @PostConstruct
    public void start() {
        Spider.create(myPageProcessor).addUrl("https://list.suning.com/?safp=d488778a.homepage1.99345513004.1&safpn=10001").thread(1).start();
    }
}
